<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
    String path = request.getContextPath() + "/";
%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="css/pintuer.css">
    <link rel="stylesheet" href="css/admin.css">
    <script src="js/jquery.js"></script>
    <script src="js/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head">
        <strong class="icon-reorder">人员管理</strong>
        <h3 style="color: red;float: right" >${MSG}</h3>
    </div>
    <div class="padding border-bottom">
        <ul class="search">
            <form action="search.do" method="post" id="form_search">
                <li>
                    <input type="text" name="value" id="search_data" placeholder="请输入">&nbsp;&nbsp;
                    <input type="radio" name="type" value="姓名" checked="checked">姓名
                    <input type="radio" name="type" value="职务">职务
                    <input type="radio" name="type" value="mail">mail
                    <input type="radio" name="type" value="age">年龄
                    <input type="button" style="width: 50px;height: 25px" id="search" value="搜索"></input>
                </li>
            </form>
        </ul>
    </div>
    <table class="table table-hover text-center">
        <tr>
            <th>员工姓名</th>
            <th>mail</th>
            <th>住址</th>
            <th>性别</th>
            <th>年龄</th>
            <th>职位</th>
            <th colspan="2">操作</th>
        </tr>
        <c:forEach items="${userList}" var="user">
            <form action="update.do" method="get">
                <input type="hidden" value="${user.user_id}" name="user_id">
                <tr>
                    <td><input type="text" name="name" value="${user.name }" style="border: none;text-align: center"></td>
                    <td><input type="text" name="mail" value="${user.mail}" style="border: none;text-align: center"></td>
                    <td><input type="text" name="address" value="${user.address }" style="border: none;text-align: center"></td>
                    <td><input type="text" name="sex" value="${user.sex }" style="border: none;text-align: center"></td>
                    <td><input type="text" name="age" value="${user.age }" style="border: none;text-align: center"></td>
                    <td><input type="text" name="role_name" value="${user.role_name }" style="border: none;text-align: center"></td>
<%--                    <td><input type="submit" value="修改" style="color: blue" ></td>--%>
                    <td><button type="submit" style="color: blue" >修改</button></td>
                    <td><a href="" style="color: red" onclick="ckeck_del(this)" id="${user.user_id}">删除</a></td>
                </tr>
            </form>
        </c:forEach>
    </table>
</div>
</body>
<script src="<%=path%>js/jquery.js"></script>
<script>
    $("#search").click(function () {
        var values=$("#search_data").val();
        if(values==''||values==null||values==undefined){
            alert("请输入查询数据！");
        }
        else {
            $("#form_search").submit();
        }
    })
    function ckeck_del(obj){
        var ids=obj.id;//获取对象的id
        con=confirm("你确认要删除该数据吗？");
        if(con==true){//点击了确认
            $("#"+ids).attr("href","delete.do?user_id="+ids);
        }
        else {
            $("#"+ids).attr("href","");
        }
    }
</script>
</html>